package com.cwt_taxi_xa.receiver;

import com.cwt_taxi_xa.util.AppLog;
import com.cwt_taxi_xa.util.StringUtil;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class UsbStatesReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		if (intent.getAction().equals(Intent.ACTION_MEDIA_MOUNTED) || intent.getAction().equals(Intent.ACTION_MEDIA_CHECKING)) {
			// U盘插入
			Toast.makeText(context, "U盘插入", 1500).show();
			AppLog.e("----------------------1");
			String path = intent.getDataString().split("file://")[1];
//				if(!StringUtil.isNull(path) && path.contains("usbhost")){
			AppLog.e("----------------------"+intent.getDataString());
			AppLog.e("----------------------"+path);
//				}
			AppLog.e("----------------------2");
		} else {
			// U盘拔出
			Toast.makeText(context, "U盘拔出", 1500).show();
		}
	};
}